fix(code-execution): auto-wrap multi-line function calls, serialize results as JSON#6267
Closed
rabi wants to merge 1 commit intoblock:mainfrom
Closed
fix(code-execution): auto-wrap multi-line function calls, serialize results as JSON#6267rabi wants to merge 1 commit intoblock:mainfrom
rabi wants to merge 1 commit intoblock:mainfrom
Conversation
84e9a27 to
ae1ce5f
Compare
…esults as JSON - Extract wrap_code_for_result() to handle multiline expressions ending with }); - Detect continuation lines (closing brackets, method chaining) - Find expression start for proper wrapping instead of wrapping interior lines - Serialize results using to_json() instead of display() to show actual array/object contents - Update LLM instructions for clearer code formatting guidance Signed-off-by: rabi <ramishra@redhat.com>
alexhancock
reviewed
Jan 5, 2026
Collaborator
alexhancock
left a comment
There was a problem hiding this comment.
thanks for looking at this
the result wrapping/capture was always one of my least favorite parts of what I originally merged. let me take a look at a more comprehensive fix that would avoid the need for something like this. if I don't come up with anything in a day or two we can proceed with this
Collaborator
Contributor
Author
|
Closing in favor of #6343 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The code execution extension's result wrapping logic only looked at the last line of code, not the complete multi-line statement. When code ended with continuation characters like
});, the wrapping produced invalid JavaScript syntax like__result__ = })), causing parse errors and infinite retry loops.Type of Change
AI Assistance
Testing
Unit tests and manual testing.
Related Issues
Closes: #6266